package com.treasure.mall.biz.repository.auction;

import com.treasure.mall.biz.base.JpaSearchableRepository;
import com.treasure.mall.biz.entity.auction.AuctionBidPO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @author allan
 * @version 1.0.0
 * @date 2020/7/16
 */
@Repository
public interface AuctionBidRepository extends JpaSearchableRepository<AuctionBidPO, Long> {
    AuctionBidPO findTopBySessionPO_IdOrderByBidAmountDesc(Long sessionId);

    AuctionBidPO findBySessionPO_IdAndSuccessIsTrue(Long sessionId);

    List<AuctionBidPO> findBySessionPO_IdOrderByBidAmountDesc(Long sessionId);

    List<AuctionBidPO> findBySessionPO_IdAndSuccessIsFalse(Long sessionId);

    AuctionBidPO findBySessionPO_IdAndUserPO_UserId(Long sessionId, Long userId);

    Page<AuctionBidPO> findBySessionPO_IdOrderByBidAmountDesc(Long sessionId, Pageable pageable);
}
